﻿using System.ComponentModel;

namespace Bon_It.Model.TransferObjects
{
    using System.Runtime.Serialization;

    /// <summary>
    /// The bookingitem.
    /// </summary>
    [DataContract]
    public class BookingItem : INotifyPropertyChanged
    {

        public BookingItem(Artikel articleItem)
        {
            ArticleID = articleItem.ID;
            ArticleName = articleItem.Bezeichnung;
            Price = articleItem.VKPreis;

            Amount = 1;
        }


        public BookingItem(Artikel articleItem, decimal amount):this(articleItem)
        {
            Amount = amount;
        }


        private long _ArticleID;

        [DataMember]
        public long ArticleID
        {
            get { return _ArticleID; }
            set
            {
                _ArticleID = value;
                OnPropertyChanged("ArticleID");
            }
        }

        private decimal _Price;

        [DataMember]
        public decimal Price
        {
            get { return _Price; }
            set
            {
                _Price = value;
                OnPropertyChanged("Price");
            }
        }

        private string _ArticleName;

        [DataMember]
        public string ArticleName
        {
            get { return _ArticleName; }
            set
            {
                _ArticleName = value;
                OnPropertyChanged("ArticleName");
            }
        }


        private decimal _Amount;

        [DataMember]
        public decimal Amount
        {
            get { return _Amount; }
            set
            {
                _Amount = value;
                OnPropertyChanged("Amount");
            }
        }

        /// <summary>
        /// Automatic calulated price.
        /// </summary>
        public decimal Total
        {
            get { return Amount * Price; }
        }

        private void OnPropertyChanged(string propertyName)
        {
            
        }
        #region Implementation of INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
